<?php

namespace App\Controller\User\Activity;

use App\Controller\User\BaseController;
use App\Service\Activity\ActivityService;
use Hyperf\Di\Annotation\Inject;
use Yj\Apidog\Annotation\ApiController;
use Yj\Apidog\Annotation\FormData;
use Yj\Apidog\Annotation\PostApi;

/**
 * @Notes: []
 * @User: zwc
 * @Date: 2022/3/8 13:32
 * @ApiController(prefix="user/activity")
 */
class ActivityController extends BaseController
{

    /**
     * @Inject()
     * @var ActivityService
     */
    protected $activityService;

    /**
     * @PostApi(path="lists",description="活动列表")
     */
    public function lists()
    {
        $data = $this->activityService->lists();
        _SUCCESS($data);
    }

    /**
     * @PostApi(path="join",description="加入")
     * @FormData(key="activityId",rule="required")
     */
    public function join()
    {
        $uid = $this->getUid();
        $params = $this->getValidatorData();
        $this->activityService->join($uid, $params->get('activityId'));
        _SUCCESS();
    }
}